// commons/diy/block/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    block_id: {
      type:Number,
      value:0
    },
    block_list: {
      type:Object,
      value: null
    },
    // block_id: {
    //   type: Number,
    //   value: 0
    // }
  },
  ready: function () {
    this.setData({
      store: wx.getStorageSync('store')
    })
    if (!this.properties.block_list) {
      this.getDiyInfo();
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    
  },

  /**
   * 组件的方法列表
   */
  methods: {
    navigatorClickBabber: function (t) {console.log(t);
      this.triggerEvent('navigatorClickBabber', t);
      return false;
    },
    getDiyInfo: function () {
      var that = this;
      var shop = wx.getStorageSync('address_info');
      var shop_id = shop && shop.shop_id ? shop.shop_id : 0
      var item = {
        name: 'block',
        shop_id: shop_id,
        block_id: that.properties.block_id
      };
      getApp().request({
        url: getApp().api.index.get_diy_info,
        data: item,
        success: function(t) {console.log(t);
          that.setData({
            block_list: t.data.list
          })
        },
        complete: function() {
          
        }
      })
    },
  }
})
